package com.xudayong.Demo;
//可变参数练习之统计分数
public class Demo04 {
    public static void main(String[] args) {
      HspMethod hspMethod=new HspMethod();
        System.out.println(hspMethod.showScore("zhangfei",108,76,35,99,43));
    }
    static class  HspMethod{
        public  String  showScore(String name, double... score){
               double sum =0;
            for (int i = 0; i <score.length ; i++) {
                sum+=score[i];
            }
            return name +"有"+ score.length+"门分数为:"+sum;
        }
    }
}
